Skip to content

Conversation

@kfc35
Copy link
Contributor

@kfc35 kfc35 commented Jan 6, 2026

Objective

Solution

  • Creates a new example called directional_navigation_overrides (examples/ui/navigation/directional_navigation_overrides.rs) that demonstrates both auto navigation and manually defining edges via the DirectionalNavigationMap. The example uses the previous auto navigation example (now at examples/ui/navigation/directional_navigation.rs) as a base. It creates pages of AutoDirectionalNavigation buttons depicting different scenarioes where manual navigation is needed to create a desired experience.
  • Refactors the navigation examples like @it-me-joda into a subfolder. Renamed the examples to express their purpose, and removed the purely manual nav example since it is not useful anymore.

Testing

  • The example runs great cargo run --example directional_navigation_overrides. Screen recording attached.
  • The other example still runs via cargo run --example directional_navigation

Showcase

Screen Recording
Screen.Recording.2026-01-13.at.1.46.09.AM.mov

Copy link
Contributor

@it-me-joda it-me-joda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that I personally would rather have each navigation mode in a separate example. Then maybe a third that demonstrates that you could combine them? This current state is overwhelming at first glance. I think I would have examples like:

ui/navigation/
    auto-navigation
    manual-navigation
    combined-navigation

But that's just my personal opinion. I'd be curious to see what others think about it.

@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples A-UI Graphical user interfaces, styles, layouts, and widgets S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 7, 2026
@alice-i-cecile
Copy link
Member

I agree with @it-me-joda here, with the emphasis in the third example focusing on how and why to use overrides.

@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 7, 2026
@kfc35 kfc35 marked this pull request as draft January 7, 2026 19:14
@kfc35 kfc35 force-pushed the 22299_auto_and_manual_dir_nav branch 3 times, most recently from 159b127 to fc1c24d Compare January 11, 2026 21:31
@kfc35 kfc35 force-pushed the 22299_auto_and_manual_dir_nav branch from 8709d09 to 425a63b Compare January 12, 2026 04:04
@kfc35 kfc35 marked this pull request as ready for review January 12, 2026 04:13
@kfc35 kfc35 changed the title New navigation example combining auto and manual directional nav New combined_navigation example combining auto and manual directional nav Jan 12, 2026
@kfc35 kfc35 added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Jan 12, 2026
@kfc35
Copy link
Contributor Author

kfc35 commented Jan 13, 2026

I incorporated @viridia ’s scenario as the page 2 of buttons ,and I inverted vertical navigation in page 3 to demonstrate a whimsy override.

The updated screen recording (which is also available in the description) is here
Screen.Recording.2026-01-13.at.1.46.09.AM.mov

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, this is starting to look good!

There's a few notes on pedagogical structure:

  1. Automatic directional navigation should be the default for 99% of users; the example should be renamed to simply directional_navigation.
  2. Now that it exists, the manual_navigation example is misleading: no one should be doing this. It should be removed completely.
  3. The primary point of manual navigation is now for overriding edge cases produced by automatic directional navigation. The example name and module docs providing context should be reworked to reflect that; perhaps directional_navigation_overrides.rs?

The setup and content of the new example are quite nice though; I have no complaints there! Lots of boilerplate to set up the complex layout, but I'm happy with how clear it is.

@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged X-Contentious There are nontrivial implications that should be thought through D-Straightforward Simple bug fixes and API improvements, docs, test and examples and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 13, 2026
@kfc35 kfc35 added the C-Docs An addition or correction to our documentation label Jan 13, 2026
@kfc35 kfc35 force-pushed the 22299_auto_and_manual_dir_nav branch from 39207ce to f246aeb Compare January 13, 2026 20:55
@kfc35
Copy link
Contributor Author

kfc35 commented Jan 13, 2026

@alice-i-cecile I agree with your structure notes and implemented them. directional_navigation_overrides.rs sounds fine if not long, but could not think of a better name

I also went over the comments in the modules and updated them to the best of my ability to make the recommended uses clearer and the interactions with each other clearer

I’m happy with the example now too :) feels comprehensive

@kfc35 kfc35 requested a review from alice-i-cecile January 13, 2026 21:26
@kfc35 kfc35 added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Jan 13, 2026
@kfc35 kfc35 changed the title New combined_navigation example combining auto and manual directional nav New directional_navigation_overrides example combining auto dir nav w/ manual overrides Jan 13, 2026
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better! That's much clearer to users IMO.

BTW, you can doc-link your structs in the module docs of examples. This is mildly nice to do, because then they break when we rename things :)

Copy link
Contributor

@it-me-joda it-me-joda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the split. If there is any advanced use cases I think we could add more examples later but this looks good to me

@kfc35 kfc35 added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 14, 2026
.insert_resource(AutoNavigationConfig {
// Require at least 10% overlap in perpendicular axis for cardinal directions
min_alignment_factor: 0.1,
// Don't connect nodes more than 200 pixels apart
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update the docs for this field, it should be specific about how the distance is measured.

Maybe could mention here that the distance is from closest edge to closest edge, not center to center.

Copy link
Contributor

@ickshonpe ickshonpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice now, I don't see any problems. Switching to multi page navigation was a great idea.

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 14, 2026
Merged via the queue into bevyengine:main with commit 76df45d Jan 14, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-UI Graphical user interfaces, styles, layouts, and widgets C-Docs An addition or correction to our documentation C-Examples An addition or correction to our examples D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Contentious There are nontrivial implications that should be thought through

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bevy_input_focus: No example demonstrates how to use the DirectionalNavigationMap and automatic navigation together

5 participants